<!--Gordana Pejic 191/01-->
<!-- Sofija Puric 6/08 -->
<?php

require 'pages/db.php';
$con=dbConnect("sib");

$sql = "SELECT IDEvent, Name, CreationDate, BriefDescription, Url, Alt
    FROM event ORDER BY CreationDate DESC LIMIT 5";

$result = mysql_query($sql, $con);
if (!$result)
    die('Error: ' . mysql_error());



while ($row = mysql_fetch_array($result)) {
    $new = explode('-', $row["CreationDate"]);
    $year = $new[0]; $month = $new[1]; $day = $new[2][0].$new[2][1];
    $new_day = $day.'.'.$month.'.'.$year.'.';
    echo '
 
                        <div class="event">
                            <div class="title">
                                <h3>'.$row["Name"].'</h3>
                                <p>posted on '.$new_day.'</p>
                            </div>

                            <img src="'.$row["Url"].'" alt="'.$row["Alt"].'"/>
                            <p>
                                '.$row["BriefDescription"].'
                            </p></div>


                        
    ';
   
}

?>
